import request from '@/utils/request';
import { BarrierList, SafetyTrend } from './types';

export const getSafetyTrend = (equipmentId: number) => {
  return request<SafetyTrend>({
    url: '/barrierIntegrity/safetyTrend',
    method: 'get',
    params: { equipmentId }
  });
};
export const getRiskMatrix = (type: number) => {
  return request({
    url: '/barrierIntegrity/riskMatrix',
    method: 'get',
    params: { type }
  });
};
export const getBarrierList = () => {
  return request<BarrierList>({
    url: '/barrierIntegrity/barrierList',
    method: 'get'
  });
};
export const getBarrierMap = (eventId: number) => {
  return request({
    url: '/barrierIntegrity/barrierMap',
    method: 'get',
    params: { eventId }
  });
};

export const getChainAlarm = (equipmentId?: number, code?: string) => {
  return request({
    url: '/barrierIntegrity/chainAlarm',
    method: 'get',
    params: { equipmentId, code }
  });
};
